<template>
  <section class="container">
    <div>
      <h1 class="title">
        {{test}}
      </h1>
      <h2 class="subtitle">
        {{project}}
      </h2>
       <h3 class="subtitle">
        {{ajax}}
      </h3>
    </div>
  </section>
</template>
<script>
import axios from 'axios'

axios.defaults.baseURL = 'http://localhost:3000/api/';

export default {

  /*
  async asyncData({ app }) {
    const { data } = await app.axios.get('get_members_count')
    return {
      project: data.count
    }
  }
  */
  
  asyncData({ app ,req, params }) {
    console.log(params);
    return app.axios.get('get_members_count')
      .then((res) => {
        return { project: res.data.count }
      })
  },


  /**ssr & fsr **/
  data() {
    return {
      project: 0,
      test: 'test',
      ajax: null
    }
  },

  created() {
     console.log('test');
      let tthis = this;
      axios.get('get_members_count')
      .then((res) => {
         tthis.ajax = res.data.count;
      })
    
  }





}

</script>
<style>
.container {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.title {
  font-family: "Quicksand", "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* 1 */
  display: block;
  font-weight: 300;
  font-size: 100px;
  color: #35495e;
  letter-spacing: 1px;
}

.subtitle {
  font-weight: 300;
  font-size: 42px;
  color: #526488;
  word-spacing: 5px;
  padding-bottom: 15px;
}

.links {
  padding-top: 15px;
}

</style>
